<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>循环跟双向绑定</title>
</head>
<script src="https://unpkg.com/vue@next"></script>
<body>
    <div id="root"></div>    
    
</body>
<script>
   const app = Vue.createApp({
    data() {
        return {
            inputValue: '',
            list: []
        }
    },
    methods: {
        handlerClick() {
            this.list.push(this.inputValue);
            this.inputValue = ''
        }
    },
    template: `
        <div>
            <input v-model='inputValue'/>
            <button v-on:click="handlerClick">添加</button>
            <ul>
                <li v-for="(item, index) of list">{{item}}</li>
            </ul>
        </div>
    `
   }).mount('#root')
</script>
</html>

<!-- v-model 数据绑定 -->
<!-- v-on -->